Skip to content

fix(tui): use cross-platform path module for plugin name extraction in /status dialog#34183

Closed
spaciousejar wants to merge 1 commit into
anomalyco:devfrom
spaciousejar:fix-tui-status-windows
Closed

fix(tui): use cross-platform path module for plugin name extraction in /status dialog#34183
spaciousejar wants to merge 1 commit into
anomalyco:devfrom
spaciousejar:fix-tui-status-windows

Conversation

@spaciousejar

@spaciousejar spaciousejar commented Jun 27, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #34141

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

On Windows, the /status dialog displays a truncated path prefix (e.g. C:\\Users\\abc) instead of the actual plugin name for file-based plugins in ~/.config/opencode/plugins/.

Root cause in packages/tui/src/component/dialog-status.tsx:

  1. split("/") does not split Windows backslash paths — returns the entire path as a single element
  2. .split(".")[0] on the full path captures the first dot in the path (.config) rather than the file extension

Fix: replace manual string splitting with path.basename() and path.dirname() from node:path, which handle both Unix (/) and Windows (\\\\) path separators correctly. The local variable was renamed from path to filePath to avoid shadowing the path module import.

How did you verify your code works?

  • Ran bunx tsc --noEmit — no new type errors introduced (all 33 errors are pre-existing, none in dialog-status.tsx)
  • Verified the logic by tracing the new code path:
    • Windows path C:\\Users\\abc\\.config\\opencode\\plugins\\my-plugin\\index.tspath.basename returns index.tsindex → falls through to parent dir my-plugin
    • Unix path /home/user/.config/opencode/plugins/my-plugin.tspath.basename returns my-plugin.tsmy-plugin
    • File without extension /path/to/my-pluginpath.basename returns my-plugin → no dot → returns as-is ✓

Screenshots / recordings

N/A — TUI change, no screenshot possible.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…n /status dialog

Replace manual path string manipulation (split('/') and split('.')[0])
with path.basename() and path.dirname() from node:path, which
handle both Unix forward-slash and Windows backslash paths correctly.

Fixes anomalyco#34141
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jun 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found

PR #33375: fix(tui): use cross-platform path splitting for local plugin names in status dialog
#33375

This PR appears to address the same issue — fixing cross-platform path handling for plugin name extraction in the status dialog. Both PRs target the same file (dialog-status.tsx) and address the same Windows path separator problem. You should check if PR #33375 is still open or already merged before proceeding.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jun 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@spaciousejar

Copy link
Copy Markdown
Author

Duplicate of #33375 — same bug, same file, different approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(tui): /status shows path prefix instead of plugin name on Windows

1 participant